package cn.bsb.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.bsb.pojo.Thematic;
import tk.mybatis.mapper.common.Mapper;

public interface thematicMapper extends Mapper<Thematic> {
	//查询所有专题
	@Select("select * from thematic")
	public List<Thematic> getAllList();
	//根据name模糊查询
	@Select("SELECT * FROM thematic WHERE `name` LIKE CONCAT ('%',#{name},'%')")
	public List<Thematic> getList(@Param("name")String name);
	//根据ID查询专题
	@Select("select * from thematic where id=#{id}")
	public Thematic getOne(@Param("id")Long id);
	//添加专题
	@Insert("insert into thematic (`name`,createId,createtime) values (#{name},#{createId},now())")
	public int addThematic(@Param("name")String name,@Param("createId")Long createId);
	//�޸�ר��
	@Update("update thematic set `name`=#{name},modifyId=#{modifyId},modifytime=now() where id=#{id}")
	public int updateThematic(@Param("id")Long id,@Param("name") String name,@Param("modifyId")Long modifyId );
	//删除专题
	@Delete("delete from thematic where id=#{id}")
	public int deleteThematic(@Param("id")Long id);
}
